package com.fr.chart.plot;

import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLableReader;
import com.fr.chart.core.glyph.LinePlotGlyph;
import com.fr.chart.core.glyph.PlotGlyph;
import com.fr.chart.legend.LineMarkerIcon;
import com.fr.data.ChartData;

public class LinePlot extends CategoryPlot
{
  private static final long serialVersionUID = 8277372084403680598L;
  private boolean isShowLine = true;
  private boolean isShowMarker = true;

  public PlotGlyph createPlotGlyph(ChartData paramChartData)
  {
    LinePlotGlyph localLinePlotGlyph = new LinePlotGlyph();
    install4PlotGlyph(localLinePlotGlyph, paramChartData);
    installAxisGlyph(localLinePlotGlyph, paramChartData);
    return localLinePlotGlyph;
  }

  public void install4PlotGlyph(LinePlotGlyph paramLinePlotGlyph, ChartData paramChartData)
  {
    super.install4PlotGlyph(paramLinePlotGlyph, paramChartData);
    paramLinePlotGlyph.setShowLine(this.isShowLine);
    paramLinePlotGlyph.setShowMarker(this.isShowMarker);
  }

  public boolean isShowLine()
  {
    return this.isShowLine;
  }

  public void setIsShowLine(boolean paramBoolean)
  {
    this.isShowLine = paramBoolean;
  }

  public boolean isShowMarker()
  {
    return this.isShowMarker;
  }

  public void setIsShowMarker(boolean paramBoolean)
  {
    this.isShowMarker = paramBoolean;
  }

  protected LineMarkerIcon getLineMarkerIconByIndex(int paramInt)
  {
    return getLineMarkerIconByIndex4Line(paramInt);
  }

  protected boolean showLegendLine()
  {
    return this.isShowLine;
  }

  protected boolean showLegendMarker()
  {
    return this.isShowMarker;
  }

  public boolean match4GUI(Plot paramPlot)
  {
    return ((super.match4GUI(paramPlot)) && (this.isShowMarker == ((LinePlot)paramPlot).isShowMarker));
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    super.readXML(paramXMLableReader);
    if (paramXMLableReader.isChildNode())
    {
      String str1 = paramXMLableReader.getTagName();
      if ("Show".equals(str1))
      {
        String str2;
        if ((str2 = paramXMLableReader.getAttr("showMarker")) != null)
          setIsShowMarker(Boolean.valueOf(str2).booleanValue());
        if ((str2 = paramXMLableReader.getAttr("showLine")) != null)
          setIsShowLine(Boolean.valueOf(str2).booleanValue());
      }
    }
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    paramXMLPrintWriter.startTAG("Plot");
    super.writeXML(paramXMLPrintWriter);
    paramXMLPrintWriter.startTAG("Show").attr("showMarker", this.isShowMarker).attr("showLine", this.isShowLine).end();
    paramXMLPrintWriter.end();
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    LinePlot localLinePlot = (LinePlot)super.clone();
    return localLinePlot;
  }

  public boolean equals(Object paramObject)
  {
    if (!(paramObject instanceof LinePlot))
      return false;
    LinePlot localLinePlot = (LinePlot)paramObject;
    if (!(super.equals(localLinePlot)))
      return false;
    if (localLinePlot.isShowLine() != isShowLine())
      return false;
    return (localLinePlot.isShowMarker() == isShowMarker());
  }
}